home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / LIBRARY / PASCALL / TEMPJUNK / INDEXING.PAS < prev    next >
Pascal/Delphi Source File  |  1992-10-14  |  2KB  |  96 lines

  1. unit indexing;
  2. interface
  3. type
  4.      Fullname=record
  5.           Firstname:string[15];
  6.           Middlename:string[5];
  7.           Lastname:string[20];
  8.      end;
  9.  
  10.      states=1..51;
  11.      FullAddress=record
  12.           Home#:word;
  13.           Street#:sting[40];
  14.           City:string[20];
  15.           State:states;
  16.           zipcode:word;
  17.      end;
  18.      
  19.      months=1..12;
  20.      longmonth=1..31;
  21.      smallmonth=1..30;
  22.      unleapfeb=1..28;
  23.      leapfeb=1..92
  24.      Birthdate=record
  25.           Year:byte;
  26.           case Month:months; of
  27.                1,3,5,7,8,10,12: Day:largemonth;
  28.                4,6,9,11: Day:smallmonth;
  29.                2: case int(year/4) of
  30.                     (year/4): Day:leapfeb
  31.                          else Day:unleapfeb;
  32.      end;
  33.  
  34.      Person=record
  35.           Name:fullname;
  36.           Address:fulladdress;
  37.           Birthday:birthdate;
  38.      end;
  39.      Datafile=file of person;
  40.                
  41. function fullmonthname(month:months):string[20];
  42. function abbreviatemonthname(month:months):string[10];
  43. function fullstatename(state:states):string[20];
  44. fucntion abbreviatestatename(state:states):string[10];
  45.  
  46. implementation
  47. uses
  48.      dos;
  49.  
  50. const
  51.      monthsdata=fexpand('months.dat');
  52.      statesdata=fexpand('states.dat');
  53.  
  54. type
  55.      staterecord=record
  56.           fullname:string[20];
  57.           abbreviation:string[10];
  58.      end;
  59.      monthrecord=record
  60.           fullname:string[20];
  61.           abbreviation:string[10];
  62.      end;
  63.      monthrecordfile=file of monthrecord;
  64.      staterecordfile=file of staterecord;
  65.  
  66. var
  67.      monthsdata:monthrecordfile;
  68.      statesdata:staterecordfile;
  69.  
  70. function fullmonthname(month:months):string[20];
  71. begin
  72.      seek(monthsdata,month);
  73.      fullmonthname:=monthsdata^.fullname;
  74. end;
  75.  
  76. function abbreviatemonthname(month:months):string[10];
  77. begin
  78.      seek(monthsdata,month);
  79.      abbreviatemonthname:=monthsdata^.abbreviation;
  80. end;
  81.  
  82. function fullstatename(state:states):string[20];
  83. begin
  84.      seek(statesdata,state);
  85.      fullstatename:=statesdata^.fullname;
  86. end;
  87.  
  88. fucntion abbreviatestatename(state:states):string[10];
  89. begin
  90.      seek(statesdata,state);
  91.      abbreviatestatename:=statesdata^.abbreviation;
  92. end;
  93.  
  94.  
  95. end.
  96.